public class Sort {

    public static void sort(int[] nums, int lo, int hi) {
        for (int i = lo; i <= hi; i++) {
            int minIndex = i;
            for (int j = i + 1; j <= hi; j++) {
                if (nums[minIndex] > nums[j]) {
                    minIndex = j;
                }
            }
            int temp = nums[i];
            nums[i] = nums[minIndex];
            nums[minIndex] = temp;
        }
    }

    public static void main(String[] args) {
        int[] nums = {3, 5, 1, 2, 0};
        sort(nums, 0, 4);
        for (int i = 0; i < nums.length; i++) {
            System.out.print(nums[i] + " ");
        }
    }

}
